﻿

namespace 云起停车_岗亭端
{
    public class Barrier
    {
        public int id { set; get; }
        public int pid { set; get; }
        public string title { set; get; }
        public int parking_id { set; get; }
        public string barrier_type { set; get; }
        public string serialno { set; get; }
        public string local_ip { set; get; }
        public string url { set; get; }
        public RtspControl.VideoControl rtsp { set; get; }
        public Barrier[] childs { set; get; }

        public static Barrier getBarrierById(Barrier[] barriers,int barrier_id)
        { 
            foreach (Barrier barrier in barriers)
            {
                if (barrier.id == barrier_id)
                {
                    return barrier;
                }
            }
            throw new System.Exception("找不到通道");
        }

        public static Barrier getBarrierBySerialNo(Barrier[] barriers, string serialno)
        {
            foreach (Barrier barrier in barriers)
            {
                if (barrier.serialno == serialno)
                {
                    return barrier;
                }
            }
            throw new System.Exception("找不到通道");
        }
    }
}
